package com.itheima.day09_set.develophomework;

import java.util.Set;
import java.util.TreeMap;

public class Test03 {
    public static void main(String[] args) {
        TreeMap<Student, Integer> t = new TreeMap<>((o1, o2) -> {
            int result = o2.sum() - o1.sum();
            result = result == 0 ? o2.getChinese() - o1.getChinese() : result;
            return result;
        });
        Student s1 = new Student("马冬梅", 92, 87, 93);
        Student s2 = new Student("夏洛", 79, 97, 81);
        Student s3 = new Student("袁华", 97, 93, 94);
        Student s4 = new Student("大春", 85, 88, 91);
        Student s5 = new Student("秋雅", 95, 90, 99);
        t.put(s1, s1.sum());
        t.put(s2, s2.sum());
        t.put(s3, s3.sum());
        t.put(s4, s4.sum());
        t.put(s5, s5.sum());

        Set<Student> k = t.keySet();
        for (Student s : k) {
            System.out.println(s);
        }
    }
}
